package wickethub.web.components;

import java.util.Arrays;

import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.model.IModel;

/**
 * 
 * @author Francisco Treacy
 *
 * @param <T>
 */
public class LocalizedEnumDropDownChoice <T extends Enum<?>> extends DropDownChoice<T> {

	public LocalizedEnumDropDownChoice(String id, T... values) {
		super(id, Arrays.asList(values), new ChoiceRenderer<T>("name"));
	}
	
	public LocalizedEnumDropDownChoice(String id, IModel<T> model, T... values) {
		super(id, model, Arrays.asList(values), new ChoiceRenderer<T>("name"));
	}

	public LocalizedEnumDropDownChoice(String id, IModel<T> model, String propertyName, T... values) {
		super(id, model, Arrays.asList(values), new ChoiceRenderer<T>(propertyName));
	}
	
	@Override
	protected boolean localizeDisplayValues() {
		return true;
	}
	
}